libobs_wrapper\utils\traits/
mod.rs

1use crate::{
2    data::{immutable::ImmutableObsData, ObsData, ObsObjectUpdater},
3    runtime::ObsRuntime,
4};
5
6use super::ObsError;
7
8pub trait ObsUpdatable {
9    /// Updates the object with the current settings.
10    /// For examples please take a look at the [Github repository](https://github.com/libobs-rs/libobs-rs/blob/main/examples).
11    fn create_updater<'a, T: ObsObjectUpdater<'a, ToUpdate = Self> + Send + Sync>(
12        &'a mut self,
13    ) -> Result<T, ObsError>
14    where
15        Self: Sized + Send + Sync,
16    {
17        let runtime = self.runtime();
18        T::create_update(runtime, self)
19    }
20
21    fn runtime(&self) -> ObsRuntime;
22
23    // We don't really need a mut here, but we do it anyway to give the dev a *feeling* of changing something
24    fn update_raw(&mut self, data: ObsData) -> Result<(), ObsError>;
25    fn reset_and_update_raw(&mut self, data: ObsData) -> Result<(), ObsError>;
26    fn get_settings(&self) -> Result<ImmutableObsData, ObsError>;
27}